﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Content;
using Rites;

namespace Rites.UI
{
    // Ok then, we're going to need a cursor and some mouse event data, and we'll tie it in to the mouse. So here we go, a MouseHandler 
    // (Not to be confused with a rat catcher)
    public class UIMouseHandler
    {
        private Vector2 cursorPosition;
        private Texture2D cursorTexture;
        private MouseState mouseState;
        
        public void MouseHandler()
        {
        }

        public void Update()
        {
            mouseState = Mouse.GetState(); //Needed to find the most current mouse states.
            this.cursorPosition.X = mouseState.X; //Change x pos to mouseX
            this.cursorPosition.Y = mouseState.Y; //Change y pos to mouseY
        }

        public void Draw(SpriteBatch batch)
        {
            batch.Draw(this.cursorTexture, this.cursorPosition, Color.White);
        }

        //LoadContent is called once up front, we use it to load Content resource - textures, sounds etc.
        public void LoadContent(ContentManager content)
        {
            this.cursorTexture = content.Load<Texture2D>("Textures//Cursor");
        }

        //public bool ButtonClick(UIButtonHandler b)
        //{
        //    if (this.pos.X >= b.position.X // To the right of the left side
        //    && this.pos.X < b.position.X + b.tex.Width //To the left of the right side
        //    && this.pos.Y > b.position.Y //Below the top side
        //    && this.pos.Y < b.position.Y + b.tex.Height) //Above the bottom side
        //        return true; //We are; return true.
        //    else
        //        return false; //We're not; return false.
        //}
    }
}
